<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html lang="en">
  <head>
  	<c:set value="${pageContext.request.contextPath}" var="basePath"></c:set>
	<jsp:include page="include/head.jsp"></jsp:include>
	<jsp:include page="include/js.jsp"></jsp:include>
	
    <style>
      body {
        text-align: center;
      }

      .panel {
        border: 1px solid #AAAAAA;
        border-radius: 10px 10px 10px 10px;
        margin-top: 20px;
        padding: 20px;
      }

      #container {
        text-align: center;
        padding-top: 50px;
      }

      #row { 
        margin:0 auto;
        width:470px;
      }
    </style>

  </head>
  <body>
  
    <div id="login-data">
    	Session:&nbsp;<span id="user_name">${user.name} ${user.lastname}</span>
    	<a id="icon-signout" href="${basePath}/logout"><i class="icon-signout"></i></a>
    </div>
    
    <c:if test="${alert==1}">
	    <div class="alert alert-danger alert-dismissable">
			<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
			<strong>Error.</strong> ${alertdesc}
		</div>
	</c:if>
    
    <div id="container" class="container">
        <div id="row" class="row panel">
            <legend>First login registration</legend>
            <label>Please enter your information to register. Use your institutional email.</label>
            <br/><br/>
            <form id="user_data_form" method="post" action="${basePath}/firstLoginRegistration" class="form-control">
            	<div class="input-group">
            		<input type="text" class="form-control" name="name" id="name" placeholder="First name">
            	</div>
            	<div class="input-group">
            		<input type="text" class="form-control" name="lastname" placeholder="Last name">
            	</div>
            	<div class="input-group">
  					<input type="email" class="form-control" name="mail" id="mail" placeholder="Email">
            	</div>
            	<div>
            		<input class="btn" type="submit" value="Accept"/>
            	</div>
            </form>
        </div>
    </div>

    <script>		
    	$(function() {
			$('#user_data_form').submit( function() {
				var name = $('#name').val();
				var mail = $('#mail').val();
				if (name == null || name == "" || mail == null || mail == "") {
					alert("Please fill every field");
					return false;
				} else
					return true;
			});
		});
	</script>
    
  </body>
</html>
